import { series, parallel, type TaskFunctionCallback } from "gulp";
import { sassCompileTask } from "./sass";
import { Print } from "../utils/index";
import { HtmlCompile } from "../compile/html";
import { HTML_DIR, OUT_CSS_DIR, OUT_DIR } from "../../config";

export function generateHtml() {
  let stream = null;
  const html = new HtmlCompile(HTML_DIR);
  stream = html.insertLinkCss(OUT_CSS_DIR);
  Print.success("CSS源码处理结束...");
  // html.insertHtml()
  // Print.success("HTML源码处理结束...");
  stream && html.save(OUT_DIR, stream);
}


export function mainTask(next: TaskFunctionCallback) {
  generateHtml();
  next();
}

export const entry = series(
  sassCompileTask, mainTask
);
